package thinking.in.spring.boot.samples.ienable.selctor;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableServer(type = Server.Type.FTP)
public class EnableServerBootstarp {

    public static void main(String[] args) {
        //构建Annotation 配置驱动Spring上下问
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        //注册当前引导类
        context.register(EnableServerBootstarp.class);
        //启动上下文
        context.refresh();
        //获取Server bean
        Server bean = context.getBean(Server.class);
        //启动服务器
        bean.start();
        //关闭服务器
        bean.stop();

        context.close();
    }
}
